package com.swallow.auth.common.exception;

import com.swallow.auth.common.enums.ErrorCode;
import com.swallow.auth.common.utils.MessageFormatUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author: 18310740596@163.com
 * @date: 2024-05-10 23:48:04
 * @version: v1.0
 * @describe: 错误参数替换工具类
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class ParamException extends RuntimeException {
    private String errorCode;
    private String errorMsg;
    public ParamException(ErrorCode error, String ...params) {
        super(MessageFormatUtils.msgFormat(error, params));
        this.errorCode = error.getValue();
        this.errorMsg = super.getMessage();
    }
}
